package com.example.work_news;

import android.content.Intent;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.widget.Button;

public class NewsActivity extends AppCompatActivity {
    private WebView showNews;
    private Button back;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_news);
        back = findViewById(R.id.back);
        showNews = findViewById(R.id.showNews);
        showNews.setVisibility(View.VISIBLE);
        Intent intent = getIntent();
        String news = intent.getStringExtra("url");
        WebSettings webSettings = showNews.getSettings();
        webSettings.setJavaScriptEnabled(true);
        showNews.loadUrl(news);

        back.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent intent1 = new Intent(NewsActivity.this,MainActivity.class);
                startActivity(intent1);
            }
        });
    }
}
